package org.ruiyichen.guizhou.agr.utils;

import android.text.InputFilter;
import android.text.Spanned;
import android.widget.EditText;

public class NumberInputFilter implements InputFilter {
    private EditText mEditText;

    public NumberInputFilter(EditText mEditText) {
        this.mEditText = mEditText;
    }

    @Override
    public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
        L.e("NumberInputFilter:"+source+"| mEditText.getText().toString():"+mEditText.getText().toString());
        if(StrUtil.isEmpty(source)&&mEditText.getText().toString().length()==1){
            return "0";
        }
        return null;
    }
}
